﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>经费报销-类别设置</title>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Base/BaseClass.css?cssver=4" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/avalon.min.js"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
    <script>
        var model = avalon.define({
            $id: "APP_JFBX_lBSZ", 
            modelData: { "TypeNO": "", "Class": 4 },
            CommonData: [],
            GetCommonData: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 4 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.CommonData = resultData.Result;
                    }
                })
            },
            AddColumn: function () {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=ZiDian&Class=4", "添加类别", "780", "300");
            },
            EditColumn: function (Id) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=ZiDian&Class=4&ID=" + Id, "添加类别", "780", "300");
            },
            DelColumn: function (item) {
                if (confirm("确定要删除么？")) {
                    $.post("/API/FTAPI.ashx", { Action: "DELCOLUMNBYID", P1: item.ID, P2: 4 }, function (result) {
                        var jsonresult = $.parseJSON(result)
                        if ($.trim(jsonresult.ErrorMsg) != "") {
                            ComFunJS.winwarning(jsonresult.ErrorMsg);
                        } else {
                            model.CommonData.remove(item);
                            parent.ComFunJS.winsuccess("删除成功");
                        }
                    })
                }
            }
            ,
            SetFrameHeight: function (framename) {
                var oFrm = document.getElementById(framename);
                oFrm.onload = oFrm.onreadystatechange = function () {
                    if (this.readyState && this.readyState != 'complete') return;
                    else {
                        var mainheight = $("#dvContent").height() - 45;
                        $("#" + framename).height(mainheight);
                        $("#mastmenu").height(mainheight);
                        $(window.frames[framename].document).find(".maindiv").css({ height: mainheight + "px", overflow: "auto" });
                    }
                }
            }
        });
        avalon.ready(function () {
            //获取公告栏目
            $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 4 }, function (resultData) {
                model.CommonData = resultData.Result;
            })
        })

    </script>

</head>
<body ms-controller="APP_JFBX_lBSZ">
    <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent">
        
        <div class="row contentdv" style="margin-left:20px">
            <div class="col-xs-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <a href="#" id="btADD" style=" height: 34px;line-height: 34px;" class="button  button-primary" ms-click="AddColumn()">添加报销类别</a>
                    </div>
                </div>
                <table class="table table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>序号</th>
                            <th>假别名称</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ms-repeat-item="CommonData"><th>{{$index+1}}</th><td>{{item.TypeNO}}</td><td><a href="#" ms-click="EditColumn(item.ID)">编辑</a><a href="#" style="color:red; margin-left:10px" ms-click="DelColumn(item)">删除</a></td></tr>
                    </tbody>
                </table>
            </div>
        </div>
        </div>

</body>
</html>
